﻿// ===============================================================================
// XCI.NET 西安交通信息WinForm开发框架 2018 版权所有
// ===============================================================================
using System.ComponentModel;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraTreeList.Columns;
using XCI.Windows.Controls;
using StyleFormatCondition = DevExpress.XtraTreeList.StyleFormatConditions.StyleFormatCondition;

namespace XCI.Windows.Plugin.GridSetting.UI
{
    [ToolboxItem(false)]
    public partial class TreeExpression : BaseGridExpression
    {
        public TreeExpression()
        {
            InitializeComponent();
        }

        private TreeSettingPlugin Plugin { get; set; }

        public void Initialize(TreeSettingPlugin uiplugin)
        {
            this.Plugin = uiplugin;
            MainGrid.MenuManager = Plugin.Tree.MenuManager;
            base.Initialize();
        }

        protected override FormatConditionCollectionBase GetFormats()
        {
            return Plugin.Tree.FormatConditions;
        }

        protected override TreeListColumnCollection GetTreeColumns()
        {
            return Plugin.Tree.Columns;
        }

        protected override StyleFormatConditionBase NewCondition()
        {
            var condition = new StyleFormatCondition();
            condition.Condition = FormatConditionEnum.Expression;
            Plugin.Tree.FormatConditions.Add(condition);
            return condition;
        }
    }
}
